package Sort;

public class chaRu {
    public static void main(String[] args) {
        int[] arr = new int[]{8, 7, 6, 5, 4, 3, 2, 1, 5, 4};
        insertP(arr);

    }


    public static int[] insertP(int[] arr) {
        int index = 0;
        for (int head = 0; head < arr.length; head++) {
            index = head + 1;
            int temp = arr[index];
            while (head >= 0) {
                if (temp < arr[head]) {
                    arr[head + 1] = arr[head];
                } else {
                    break;
                }
                head--;
                arr[head + 1] = temp;
            }
        }
        return arr;
    }
}
